<?php
namespace app\index\controller\traits;

trait Xml
{

/**
 * 配置表
 */
    function getArrFromXml($xml_file, $key, $value)
    {

        $xmlNode = simplexml_load_file($xml_file);
        $temp    = \app\ux\UtilXml::xmlToArray($xmlNode);
        $temp    = $temp ? $temp["RECORDS"]["RECORD"] : $temp;
        if ($temp) {
            $rtn = array();
            foreach ($temp as $k => $v) {
                $rtn[$v[$key]] = $v[$value];
            }
        }
        return $rtn;
    }

}
